<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
            	<div class="ct_detail_box ct_detail_pd_box_l ct_detail_box_same">
                    	<h1 class="ct_detail_pd_tt">同类推荐</h1>
                        <div class="ct_detail_box_mask" id="recContent">         
                        </div>
                        <div class="ct_detail_page">
                        	<a href="javascript:_moveNextRec();" class="detail_page_next"></a>
                        	<span id='showRecPage'></span>
                        	<a href="javascript:_movePreRec();" class="detail_page_pre"></a> 
                        </div>
                    </div>
<script type="text/javascript">
<!--
var recPageSize=6;//推荐页面大小
var recCurPage=1;//当前页面
var recCount=0;//推荐总数
var recPageCount=0;//页面总数
//移至上一页
function _movePreRec(){	
	if(recCurPage>1){
		--recCurPage;	
	}else{
		recCurPage=1;
	}
	doRecQuery();    
}
//移至下一页
function _moveNextRec(){
	if(recCurPage<recPageCount){
		++recCurPage;	
	}else{
		recCurPage=recPageCount
	}	
	doRecQuery();
}
//查询推荐列表
function doRecQuery(){
	var url="${ctx}/front!getList.action";
	$.post(url, "q_classId=${data.classId}&page="+recCurPage+"&pageSize="+recPageSize ,function callback(txt){   
			var json = $.parseJSON(txt);
			if (json.code==0) {	
				recCount=json.count;
				recPageCount=Math.floor(recCount/recPageSize)+(recCount%recPageSize==0?0:1);	
				$('#showRecPage').html(recCurPage+"/"+recPageCount);
				createRecNotes(json.info);				
			}else{
				alert('查询推荐列表失败！');
			}
		}	
	);
}
//创建商品列表数据
function createRecNotes(objs){		
	var c="";
	for(var i=0;i<objs.length;i++){
		var obj=objs[i];
		c+='<div class="ct_detail_pd_cell">';
		c+='<a href="javascript:goDetail(\''+obj.goodsId+'\');" title="'+obj.goodsName+'" class="ct_detail_pd_pic">';
		c+='    <img src="'+obj.goodsPic+'" alt="'+obj.goodsName+'" width="94" height="111" />';
		c+='</a>';   
		c+='</div>';
	}	
	$('#recContent').html(c);
}

//-->
</script>